"""

str1 = "Hello "+"Python"
print(str1)

str2 = "abc"*3
print(str2) # abcabcabc
print("abc"*3) # abcabcabc
print(3*"abc") # abcabcabc

str4 = "abcdefg"
print(str4[0])
print(str4[1])
print(str4[2])
print(str4[6]) # g
# print(str4[7]) # IndexError: string index out of range   str4字符串索引范围是0-6，超过6之后没有内容存在，所以你使用索引7超过了索引范围
print(str4[-1]) # g
print(str4[-7]) # a
# print(str4[-8]) # IndexError: string index out of range  str4字符串索引从右向左范围是-1~-7，超过-7之前没有内容，所以使用索引-8超过了索引范围

print("---------------------------")

str5 = "qwertyuiop"
print(str5) # qwertyuiop
result1 =str5[2:8:2]
print(result1)
print(str5) # qwertyuiop
print(str5[2:]) # ertyuiop
print(str5[2::2]) # etuo
print(str5[2:8]) # ertyui
print(str5[::-1]) # poiuytrewq

# in 和 not in
str6 = "abcdefg"
print("a" in str6) # True
print("A" in str6) # False
print("a" not in str6) # False
print("A" not in str6) # True

"""

str1 = "hello" + "python"
print(str1)

str2 = "abcd"
print(str2 * 3)
print(3 * str2)

str3 = "abcdefg"
print(str3[0])
print(str3[1])
print(str3[2])
print(str3[3])
print(str3[6])
print('--------------------------------')
print(str3[-1])
print(str3[-2])
print(str3[-3])
print(str3[-4])
print(str3[-5])
print(str3[-6])
print(str3[-7])

print('--------------------------------')
str4 = "qwertyasd"
print(str4[::1])
print(str4[::-1])
print(str4[2::])
print(str4[:2:])
print(str4[2::2])

str5='qazwsx'
print('a' in str5)
print('p' in str5)
print('a' not in str5)
print('p' not in str5)

